perm filename MKVID[G,BGB] blob sn#054447 filedate 1973-07-23 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00015 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00003 00002	TITLE MKVID  -  MAKE VIDEO  -  B.G.BAUMGART  -  1 JULY 1973.
C00007 00003	MAIN LOOP.
C00009 00004	SUBR(INIT)		INITIALIZATION.
C00010 00005	READ CLOCKS.
C00013 00006	SUBR(GETFIL)EXT 	SETUP FILE SPEC FROM TTY LINE.
C00015 00007	SUBR(INTRI)		INPUT TRIANGLES FILE.
C00017 00008	SUBR(TFILL)	TRIANGLE FILL.
C00020 00009	SUBR(FILL)
C00023 00010	SUBR(ADDSKY)	ADD SPAN INTO THE SKY ARRAY.
C00025 00011	SUBR(TVDSKO)  		INPUT TV PICTURE FROM A DISK FILE.
C00026 00012	RESET HEADER.
C00027 00013	SUBR(PACKTV)	PACK SKY RASTER INTO TV BUFFER.
C00028 00014	SUBR(RGB2IC)		CONVERT RGB TO QUAM'S IC COLOR FORMAT.
C00030 00015	DATA AREA.
C00032 ENDMK
C⊗;
TITLE MKVID  -  MAKE VIDEO  -  B.G.BAUMGART  -  1 JULY 1973.

;ALTERNATE PDP-10 MNEMONICS.
	DEFINE O(A,B){OPDEF A[B]}
	O LIP,HLR↔O LAP,HRR↔O DIP,HRLM↔O DAP,HRRM
	O ZIP,HRRZS↔O ZAP,HLLZS↔O WIP,HRROS↔O WAP,HRRZS
	O CAR,HLRZ↔O LIPI,HRLI↔O LAPI,HRRI↔O DIPZ,HRLZM
	O CDR,HRRZ↔O LACI,MOVEI↔O SLACI,MOVSI↔O DAPZ,HRRZM
	O LAC,MOVE↔O LACN,MOVN↔O LACM,MOVM↔O SLAC,MOVS
	O DAC,MOVEM↔O DACN,MOVNM↔O DACM,MOVMM↔O SDAC,MOVSM
	O NIP,HLRE↔O NAP,HRRE↔O NIM,HRREI↔O GO,JRST
	O DZM,SETZM↔O DOM,SETOM
	O FLOAT,FSC 233↔O FLO,FSC 225↔O FIXX,FIX 233000

;SAIL LIKE SUBROUTINE LINKAGE.

	↓P←←17
	DEFINE SUBR(NAME){HALT .↔XWD 777077,[SIXBIT|NAME|]
	INTERN NAME↔↓NAME: ;}
	DEFINE CALL(NAME,X1,X2,X3,X4){
	IFDIF<><X1>{PUSH 17,X1↔IFDIF<><X2>{PUSH 17,X2
	IFDIF<><X3>{PUSH 17,X3↔IFDIF<><X4>{PUSH 17,X4}}}}
	IFDIF<><NAME>{PUSHJ 17,NAME}}
	DEFINE ARG1<-1(17)>↔DEFINE ARG2<-2(17)>
	DEFINE ARG3<-3(17)>↔DEFINE ARG4<-4(17)>
	DEFINE SETQ(VAR,LIST){CALL(LIST)↔DAC 1,VAR}

;RETURN FROM AN N-ARGUMENT SUBROUTINE CALL.

	DEFINE POP0J <POPJ 17,>
	↓POP1J.:SUB 17,[2(2)]↔GO@2(17)↔DEFINE POP1J<GO POP1J.>
	↓POP2J.:SUB 17,[3(3)]↔GO@3(17)↔DEFINE POP2J<GO POP2J.>
	↓POP3J.:SUB 17,[4(4)]↔GO@4(17)↔DEFINE POP3J<GO POP3J.>
	↓POP4J.:SUB 17,[5(5)]↔GO@5(17)↔DEFINE POP4J<GO POP4J.>

;ACCUMULATOR AND TEMPORARY DATA MANAGEMENT.

	FOR @$ I←0,17{↓AC$I:0↔}
	DEFINE SAVAC $(N){LAC[XWD 2,AC2]↔BLT AC$N}
	DEFINE GETAC (N){LAC[XWD AC2,2]↔BLT N}
	DEFINE ACCUMULATORS(LIST){ACPTR←←2
	FOR AC⊂(LIST)<AC←ACPTR↔ACPTR←←ACPTR+1↔>}
	DEFINE DECLARE (LIST){
	FOR VARNAM⊂(LIST)<VARNAM: 0↔>}

;FATAL ERROR MESSAGE.

	DEFINE FATAL(STR){JSR FATAL.↔JFCL[ASCIZ/STR/]}
	FATAL.:0↔OUTSTR[BYTE(7)15,12(21)"FAT"↔"AL - "⊗1↔0]
	CDR@FATAL.↔OUTSTR@↔INCHRW↔GO .-1↔LIT
	DEFINE CRLF{OUTSTR[BYTE(7)15,12]}
;MAIN LOOP.
PDL:	BLOCK 20
SA:	LAC P,[IOWD 20,PDL]
	CALL(GETFIL,[SIXBIT/TRI/])↔EXIT		;GET FILENAME.
	INIT 1,17↔SIXBIT/DSK/↔0↔HALT
	LOOKUP 1,FILNAM↔GO SA+1
	CALL(INIT)
	CALL(INTRI)		;INPUT TRIANGLES FILE.
	SKIPE CSFLG↔GO L2

;BLACK & WHITE VIDEO SYNTHESIS.

	CALL(TFILL)↔CRLF	;FILL ALL THE TRIANGLES.
	CALL(PACKTV)		;PACK SKY ARRAY INTO TV BUFFER.
	CALL(TVDSKO)		;OUTPUT TV BUFFER TO DISK FILE.
	EXIT

;COLOR VIDEO SYNTHESIS.

L2:	CALL(TFILL)↔CRLF	;FILL ALL THE TRIANGLES.
	CALL(PACKTV)		;PACK SKY ARRAY INTO TV BUFFER.
	AOS CSFLG
	CALL(TFILL)↔CRLF	;FILL ALL THE TRIANGLES.
	CALL(PACKTV)		;PACK SKY ARRAY INTO TV BUFFER.
	AOS CSFLG
	CALL(TFILL)↔CRLF	;FILL ALL THE TRIANGLES.
	CALL(PACKTV)		;PACK SKY ARRAY INTO TV BUFFER.

	CALL(RGB2IC)		;CONVERT TO QUAM-COLOR-VIDEO.
	LACI 1↔DAC CSFLG
	CALL(TVDSKO)		;OUTPUT TV BUFFER TO DISK FILE.
	AOS CSFLG
	CALL(TVDSKO)		;OUTPUT TV BUFFER TO DISK FILE.
	EXIT
SUBR(INIT)		;INITIALIZATION.
BEGIN INIT;----------------------------------------------------------

	CDR 44↔DAC SKYPTR	      ;INITIALIZE SKY ARRAY POINTERS.
	LAC 1,[XWD -=432,PUTSKY]
	ADDM(1)↔AOBJN 1,.-1

	ADDI =31104↔DAC TVRED↔DAC TVBUF;INITIALIZE TV BUFFER POINTERS.
	ADDI =10496↔DAC TVGRN
	ADDI =10496↔DAC TVBLU
	ADDI =10496
	SKIPN CSFLG
	SUBI =20992
	CORE↔FATAL({CAN'T GET ENUF CORE.})
	POP0J

BEND INIT;7/20/73(BGB)-----------------------------------------------
;READ CLOCKS.
CLOCK:
	SETZ↔MSTIME↔DAC TIME1#
	SETZ↔RUNTIM↔DAC TIME2#
	POP0J
;PRINT CLOCKS.
PTIME:
	SETZ↔MSTIME↔SUB TIME1↔MOVM↔FLOAT↔SKIPN↔MOVSI(0.5)↔FDVRI(1000.0)↔DAC TIME1
	SETZ↔RUNTIM↔SUB TIME2↔MOVM↔FLOAT↔SKIPN↔MOVSI(0.5)↔FDVRI(1000.0)↔DAC TIME2
	FDVR TIME1↔FMPR[100.0]↔FIXX↔DAC RATIO#
	OUTSTR[ASCIZ/REAL TIME  /]↔CALL(FLODPY,TIME1,[2])↔OUTCHR[9]
	OUTSTR[ASCIZ/RUN  TIME  /]↔CALL(FLODPY,TIME2,[2])↔OUTCHR[9]
	OUTSTR[ASCIZ/TIME SHARE /]↔CALL(DECDPY,RATIO)↔CRLF
	CALL(CLOCK)
	POP0J
SUBR(DECDPY)INTEGER	;DECIMAL NUMBER DISPLAY.
BEGIN DECDPY
	LAC 1,ARG1
	POP P,-1(P)		;FETCH ARG AND LAC RET. ADR.
L1:	JUMPGE 1,L2			;TEST FOR NEGATIVE NUMBER.
	MOVM 2,1↔OUTCHR["-"]	;PRINT MINUS SIGN.
	LAC 1,2
L2:	IDIVI 1,12↔PUSH P,2		;MODULO TEN AND SAVE.
	SKIPE 1↔PUSHJ P,L2		;TEST FOR DONE.
	POP P,1↔ADDI 1,60↔OUTCHR 1	;RESTORE & PRINT.
	POP0J
BEND DECDPY;17-DEC-73(BGB)___________________________________________

SUBR(FLODPY)FLONUM,PLACES	;FLOATING NUMBER DISPLAY.
BEGIN FLODPY
	LAC ARG2
	JUMPL[OUTCHR["-"]↔LACM ARG2↔GO .+1]
	LACM 2,ARG1↔CAILE 2,6↔LACI 2,6↔DAC 2,PLACES#
	FMPR[1.↔10.↔100.↔1000.↔10000.↔100000.↔1000000.](2)↔FIXX
	IDIV[=1↔=10↔=100↔=1000↔=10000↔=100000↔=1000000](2)
	PUSH P,1↔CALL(DECDPY,0)↔POP P,0
	LAC 2,PLACES
	ADD[=1↔=10↔=100↔=1000↔=10000↔=100000↔=1000000](2)
	OUTCHR["."]↔CALL(DECDPY,0)
	POP2J
BEND FLODPY;17-DEC-73(BGB)
SUBR(GETFIL)EXT 	;SETUP FILE SPEC FROM TTY LINE.
BEGIN GETFIL;--------------------------------------------------------

	SETZM CSFLG	;COLOR SYNTHESIS FLAG.
	SETZM FILNAM
	SETZM EXTION
	SETZM EXTION+1
	SETZM PPPN

	OUTSTR[ASCIZ/	FILE = /]
	LAC 1,[POINT 6,FILNAM,-1]↔LACI 2,6
	INCHWL↔CAIL"a"↔SUBI 40
	CAIN 15↔GO[INCHWL↔POP1J]↔AOSA(P)

L:	INCHWL↔CAIL"a"↔SUBI 40
	CAIN"."↔GO[SETZM ARG1↔LAC 1,[POINT 6,EXTION,-1]↔LACI 2,3↔GO L]
	CAIN"["↔GO[LAC 1,[POINT 6,PPPN,-1]  ↔LACI 2,3↔GO L]
	CAIN","↔GO[LAC 1,[POINT 6,PPPN,17]  ↔LACI 2,3↔GO L]
	CAIN"]"↔GO L
	CAIN"$"↔GO[LACI 1↔DAC CSFLG↔GO L]  ;A COLOR PICTURE DESIRED.

	CAIN 15↔GO EOL			;END OF THE LINE.
	CAIN 12↔GO EOL
	CAIG" "↔GO L	;IGNORE GARBAGE.
	SOJL 2,L
	SUBI 40↔IDPB 1↔GO L	;ASCII TO SIXBIT.

EOL:	INCHWL↔CAR PPPN
	TRNN 77↔LSH -6↔TRNN 77↔LSH -6    ;RIGHT ADJUST PROJECT.
	DIP PPPN↔CDR PPPN
	TRNN 77↔LSH -6↔TRNN 77↔LSH -6    ;RIGHT ADJUST PROGRAMMER.
	DAP PPPN
	SKIPN 1,EXTION↔LAC 1,ARG1↔DAC 1,EXTION ;DEFAULT EXTENSION.
	LAC FILNAM↔DAC FILE		;SAVE COPY OF FILE NAME.
	POP1J
BEND GETFIL;2/18/73(BGB)---------------------------------------------
SUBR(INTRI)		;INPUT TRIANGLES FILE.
BEGIN INTRI;---------------------------------------------------------

;DUMP COMMAND WORD.
	LAC PPPN
	HRR TVBLU↔SKIPN CSFLG↔HRR TVBUF
	SOS↔DAC INARG

;INITIALIZE TRIANGLE LIST POINTER.
	CDR TVBLU↔SKIPN CSFLG↔CDR TVBUF
	ADDI 3↔DAC TPTR2↔DAC TPTR	;STEP OVER 3 WORD HEADER.

;INPUT TRANSFER.
	IN 1,INARG
	RELEASE 1,
	POP0J
INARG:0↔0
BEND INTRI;7/16/73(BGB)----------------------------------------------
SUBR(TFILL)	;TRIANGLE FILL.
BEGIN TFILL;_________________________________________________________
	ACCUMULATORS{N,V1,V2,V3,R1,R2,R3,C1,C2,C3,B1,B2,B3}
	LAC TPTR2↔DAC TPTR		;RESET TRIANGLE LIST POINTER.
	CDR 1,SKYPTR↔LACI 1(1)↔DIP 1,0
	SETZM(1)↔BLT =31104(1)		;CLEAR THE SKY.
;PICKUP A TRIANGLE.
L1:	LAC V1,TPTR↔SKIPGE(V1)↔POP0J	;EXIT AT END OF LIST.
	OUTCHR["."]
	LACI V2,2(V1)
	LACI V3,2(V2)
	LACI 1,2(V3)↔DAC 1,TPTR
;ORDER THE VERTICES.
	LAC(V1)↔CAMLE(V2)↔EXCH V1,V2
	LAC(V1)↔CAMLE(V3)↔EXCH V1,V3
	LAC(V2)↔CAMLE(V3)↔EXCH V2,V3
	LAC 1,CSFLG↔LAC 1,COLOR(1)	;FOR COLOR BYTE LSH SELECT.
;PICKUP & PLACE BINARY POINTS FOR COLUMN, ROW AND BRIGHTNESS.
L2:	FOR @$ I←1,3{
	CDR C$I,(V$I)↔LSH C$I,=15
	CAR R$I,(V$I)↔LSH R$I,-3
	LAC B$I,1(V$I)↔LSH B$I,(1)↔ANDI B$I,7770↔MOVSS B$I}
;COMPUTE DELTA'S.
L3:	LAC N,R1↔SUB N,R2
	LAC C1↔SUB C2↔SKIPE N↔IDIV N↔DAC DELC1
	LAC B1↔SUB B2↔SKIPE N↔IDIV N↔DAC DELB1
	LAC N,R1↔SUB N,R3
	LAC C1↔SUB C3↔SKIPE N↔IDIV N↔DAC DELC2
	LAC B1↔SUB B3↔SKIPE N↔IDIV N↔DAC DELB2
	LAC N,R2↔SUB N,R3
	LAC C2↔SUB C3↔SKIPE N↔IDIV N↔DAC DELC3
	LAC B2↔SUB B3↔SKIPE N↔IDIV N↔DAC DELB3
;SETUP FILL ARGUMENTS.
L4:	DAC R1,ROW1↔DAC R2,ROW2↔DAC R3,ROW3
	DAC C1,COL1↔DAC B1,BRT1↔DAC C1,COL2↔DAC B1,BRT2
	SETOM CCWFLG↔LAC DELC1↔CAMG DELC2↔GO .+8
	SETZM CCWFLG
	LAC DELC1↔EXCH DELC2↔DAC DELC1
	LAC DELB1↔EXCH DELB2↔DAC DELB1
;MAKE UPPER AND LOWER CALLS ON FILL SUBROUTINE.
L5:	CALL(FILL)
	LAC 0,DELC3↔LAC 1,DELB3
	SKIPN CCWFLG↔GO .+4
	DAC 0,DELC1↔DAC 1,DELB1↔GO .+3
	DAC 0,DELC2↔DAC 1,DELB2
	LAC ROW2↔DAC ROW1
	LAC ROW3↔DAC ROW2
	CALL(FILL)↔GO L1
BEND TFILL;BGB 2 JULY 1973.__________________________________________
SUBR(FILL)
BEGIN FILL;__________________________________________________________

;FILL MICRO ROWS (R1+1) INCLUSIVE TO R2.
;FILL MICRO PIXELS C1 INCLUSIVE TO (C2-1).

ACCUMULATORS{ROW,COL,R,C,C1,C2,B1,B2,CMIN,CMAX}
;PICKUP ARGUMENTS.
	LAC C1,COL1↔LAC C2,COL2
	LAC B1,BRT1↔LAC B2,BRT2
	LAC R,ROW1			;FIRST-1 MICRO ROW.
	LAC ROW,R↔AOS ROW↔LSH ROW,-3	;FIRST MACRO ROW.
	SLACI CMIN,=288⊗3↔SETZ  CMAX,

;ADVANCE SEGMENT A MICRO ROW.
L1:	ADD C1,DELC1↔CAMGE C1,CMIN↔DAC C1,CMIN
	ADD C2,DELC2↔CAMLE C2,CMAX↔DAC C2,CMAX
	ADD B1,DELB1↔ADD B2,DELB2↔AOS R

;DELTA MICRO COLUMNS INTO AC1.
L2:	CAR 0,C2↔CAR 1,C1
	SUB 1,0↔JUMPGE 1,L4	;IGNORE THIN (OR BACKWARDS) SEGMENTS.
	CAR C,C1↔DIP 1,C	;SETUP MICRO COLUMN AOBJN POINTER.

;DELTA BRIGHTNESS PER MICRO COLUMN INTO AC0.
	LAC B1↔SUB B2
	SKIPE↔IDIV 1
	LAC 1,B1
	CAR COL,C1↔LSH COL,-3↔GO .+3	;FIRST MACRO COLUMN.

;INNER MOST LOOP.
L3:	TRNN C,7↔AOS COL
	ADDM 1,SPAN(COL)	;ADD BRIGHTNESS OF ONE MICRO PIXEL.
	ADD 1,0			;DELTA BRIGHTNESS PER MICRO PIXEL.
	AOBJN C,L3

;ADVANCE MICRO ROW.
L4:	LDB 0,[POINT 3,R,35]
	CAMGE R,ROW2		;LAST ROW OR BEYOND OR
	CAIN 0,7↔CALL(ADDSKY)	;OR MACRO ROW BOUNARY.

;SAVE & EXIT.
	CAMGE R,ROW2↔GO L1
	DAC C1,COL1↔DAC C2,COL2
	DAC B1,BRT1↔DAC B2,BRT2
	POP0J
BEND FILL;BGB 3 JULY 1973.___________________________________________
SUBR(ADDSKY)	;ADD SPAN INTO THE SKY ARRAY.
BEGIN ADDSKY;________________________________________________________

ACCUMULATORS{ROW,COL,R,C,C1,C2,B1,B2,CMIN,CMAX}
;	ROW & COL	MACRO PIXEL LOCUS.
;	R & C		MICRO PIXEL LOCUS.
;	C1 & C2		LEFT AND RIGHT COLUMNS OF SCAN LINE SEGMENT.
;	B1 & B2		LEFT AND RIGHT BRIGHTNESS OF "  "    " .
;	CMIN & CMAX	MICRO COLUMN EXTREMA PER MACRO ROW.
;	14 15 16 P

;GET COLUMN EXTREMA INTO MACRO PIXEL UNITS.
	LSH CMIN,-=21
	LSH CMAX,-=21
	LAC COL,CMIN

;ADD SPAN PIXELS TO SKY ARRAY AND CLEAR SPAN PIXELS.
L1:	XCT GETSKY(ROW);(COL)
	CAR 1,SPAN(COL)↔ADD 0,1
	DZM SPAN(COL)
	TLNE -1↔HLLOI		;SKY PIXEL OVERFLOW.
	XCT PUTSKY(ROW);(COL)
	CAMGE COL,CMAX
	AOJA COL,L1

;INCREMENT MACRO ROW.
	AOS ROW

;RESET COLUMN EXTREMA.
	SLACI CMIN,=288⊗3↔SETZ  CMAX,
	POP0J
BEND ADDSKY;BGB 2 JULY 1973.__________________________________________
SUBR(TVDSKO)  		INPUT TV PICTURE FROM A DISK FILE.
BEGIN TVDSKO;-----------------------------------------------------

;GET FILENAME.
	LAC FILE↔SKIPN 1,CSFLG↔GO .+3
	LAC 1,['X'↔'I'↔'C'↔'X'](1)↔ROTC 0,-6↔DAC FILNAM
	LAC[SIXBIT/TMP/]↔DAC EXTION↔SETZM EXTION+1
	LAC[SIXBIT/DATBGB/]↔DAC PPPN

;INITIALIZE DISK.
	INIT 1,17↔SIXBIT/DSK/↔0↔HALT
	ENTER 1,FILNAM↔GO[OUTSTR[ASCIZ/	ENTER FAILED.
/]↔GO .+4]

;RESET HEADER.
	LAC 1,CSFLG↔LAC 1,TVBUF(1)
	DAP 1,DUMARG↔SOS DUMARG
	SLACI 0,HEAD1↔LAP 0,1↔BLT 177(1)

;DUMP MODE OUTPUT TO DISK.
	OUT 1,DUMARG↔JFCL
	OUTSTR[ASCIZ"	EOF.
"]↔	RELEASE 1,↔POP0J

;CRE-STANDARD TELEVISION FILE HEADER.
HEAD1:	-1
	6	; BITS PER BYTE.
	=48	;WORDS PER LINE.
	=20	;FIRST AND LAST ROW.
	=235
	=28
	=315	;FIRST AND LAST COL.
	XWD -=10368,200
	BLOCK 200
DUMARG:	IOWD 24400,TVBUF↔0	;ADDRESS MODIFICATION !
BEND TVDSKO; BGB 1 JULY 1973 -------------------------------------
FILE:	0
FILNAM:	0
EXTION:	0
	0
PPPN:	0
SUBR(PACKTV)	;PACK SKY RASTER INTO TV BUFFER.
BEGIN PACKTV;________________________________________________________
	ACCUMULATORS{ROW,COL,PTR,I}
	SETZ I,
	LAC PTR,[POINT 6,0]
	LAC 1,CSFLG↔HRR PTR,TVBUF(1)↔ADDI PTR,200
	SETZ ROW,
L1:	SETZ COL,
L2:	XCT GETSKY(ROW);(COL)		BRIGHTNESS 00.0000
	CAIGE 770000		;ALREADY BRIGHT ENOUGH.
	ADD RROUND(I)		;RANDOM ROUNDING.
	SOSGE I↔LACI I,=100
	LSH -=12↔IDPB PTR	;TRUNCATE AND PACK.
	CAIGE COL,=287↔AOJA COL,L2
	CAIGE ROW,=215↔AOJA ROW,L1
	POP0J
RROUND:	FOR I←0,=100{4000
}
BEND PACKTV;BGB 2 JULY 1973._________________________________________

SUBR(RGB2IC)		;CONVERT RGB TO QUAM'S IC COLOR FORMAT.
BEGIN RGB2IC;--------------------------------------------------------

	ACCUMULATORS{P1,P2,P3,Q1,Q2,I1,B1,I2,B2,R1,R2,G1,G2}

	LACI =31104↔DAC CNT#
	LAC[POINT 6,0]
	HRR TVRED↔ADDI 200↔DAC P1↔DAC Q1
	HRR TVGRN↔ADDI 200↔DAC P2↔DAC Q2
	HRR TVBLU↔ADDI 200↔DAC P3

L:	ILDB R1,P1↔ILDB G1,P2↔ILDB B1,P3	;PICK'EM UP.
	ILDB R2,P1↔ILDB G2,P2↔ILDB B2,P3

	LAC I1,R1↔ADD I1,G1↔ADD I1,B1		;ADD'EM UP.
	LAC I2,R2↔ADD I2,G2↔ADD I2,B2

	IDIVI I1,3↔IDPB I1,Q1			;INTENSITY BYTE-1.
	IDIVI I2,3↔IDPB I2,Q1			;INTENSITY BYTE-2.

	ADD R1,R2↔ADD G1,G2↔ADD I1,I2
	LAC R1↔SUB I1↔IDIVI 6↔ADDI 40↔IDPB Q2	;COLOR BYTE-1.
	LAC G1↔SUB I1↔IDIVI 6↔ADDI 40↔IDPB Q2	;COLOR BYTE-2.

	SOSLE CNT↔GO L
	POP0J
BEND RGB2IC;7/20/73(BGB)---------------------------------------------
;DATA AREA.
	CSFLG:	0	;COLOR SYNTHESIS COUNT W=0,R=1,G=2,B=3.
	COLOR:	3 ↔ -=24 ↔ -=15 ↔ -6	;COLOR BYTE SHIFT.
	CCWFLG:	0	;ORIENTATION OF TRIANGLE'S VERTICES.
	TPTR:	0
	TPTR2:	0	;SAVED TPTR.
	SPAN:	BLOCK =288	;SCAN LINE BUFFER.

;FILL ARGUMENTS.
	DECLARE{COL1,COL2,COL3}		;MICRO COL.  0.0,,0
	DECLARE{ROW1,ROW2,ROW3}		;MICRO ROW.	0.0
	DECLARE{BRT1,BRT2,BRT3}		;BRIGHTNESS 00.0000
	DECLARE{DELC1,DELC2,DELC3}	;DELTA COLUMN.
	DECLARE{DELB1,DELB2,DELB3}	;DELTA BRIGHTNESS.

;POINTER TO SKY ARRAY  -  216 ROWS OF 288 COLUMNS OF 18 BIT BYTES.
	SKYPTR:0
	SKY ←← 0
	PUTSKY:	FOR I←0,=107{	DIP 0,SKY+=288*I(3)
}		FOR I←0,=107{	DAP 0,SKY+=288*I(3)
}	GETSKY:	FOR I←0,=107{	CAR 0,SKY+=288*I(3)
}		FOR I←0,=107{	CDR 0,SKY+=288*I(3)
}
;CRE STANDARD TV FILE IS =10496 WORDS LONG, 24400 OCTAL.
;=128 WORD HEADER, =216 ROWS OF =288 COLUMNS OF 6 BITS PER PIXEL.
	TVBUF:	0
	TVRED:	0	;POINTER TO RED TV BUFFER.
	TVGRN:	0
	TVBLU:	0
END SA